package com.xixing.weixin.response;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.xixing.weixin.domain.Weixin;
import org.springframework.roo.addon.javabean.RooJavaBean;
import org.springframework.roo.addon.tostring.RooToString;

import java.util.Date;

//<xml>
//<ToUserName><![CDATA[toUser]]></ToUserName>
//<FromUserName><![CDATA[fromUser]]></FromUserName>
//<CreateTime>12345678</CreateTime>
//<MsgType><![CDATA[text]]></MsgType>
//<Content><![CDATA[content]]></Content>
//<FuncFlag>0</FuncFlag>
//</xml>
@RooJavaBean
@RooToString
public class TextResponse extends Response {


    // text
    private String content;

    public TextResponse() {
        setMsgType("text");
    }

    public static Response create(Weixin weixin, String content) {
        TextResponse result = new TextResponse();
        result.setFromUserName(weixin.getToUserName());
        result.setToUserName(weixin.getFromUserName());
        result.setCreateTime(new Date().getTime());
        result.setFuncFlag(0);
        result.setContent(content);
        return result;
    }
}
